package com.lx.patterns.iterator;

import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName StudentAggregateImpl
 * @Description: 具体学生聚合对象
 * @Author: 落雪
 * @CreateDate: 2025/2/15 10:54
 * @UpdateUser: 落雪
 * @UpdateDate: 2025/2/15 10:54
 * @UpdateRemark:
 * @Version: 1.0
 */
public class StudentAggregateImpl implements StudentAggregate{

    private List<Student> studentList = new ArrayList<>();
    @Override
    public void add(Student student) {
        studentList.add(student);
    }

    @Override
    public void remove(Student student) {
        studentList.remove(student);
    }

    @Override
    public StudentIterator getIterator() {
        return new StudentIteratorImpl(studentList);
    }
}
